class AliPay:
    def __init__(self,name):
        self.name=name
    def pay(self):
        print("%s用支付宝支付"%self.name)

class WecharPay:
    def __init__(self,name):
        self.name=name
    def pay(self):
        print("%s用微信支付"%self.name)

a=AliPay("孙悟空")
b=WecharPay("猪八戒")

#定义一个函数，将实例作为参数传进去
def pay(obj):
    print("请选择支付方式")
    obj.pay()

pay(a)